var regInt = /^([1-9]{1}\d{0,})$/;
var regFloat = /^(\d+)(\.?)(\d{0,4})$/;

/**
 * 产品名称输入框获取焦点，设置输入框校验显示信息列的样式
 */
function productNameFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "产品名称，必填，最长64个字符";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 产品类型名输入框失去焦点时的校验
 */
function productNameBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "产品名称不能为空";
    } else if(objValue.length > 64 ) {
        errMsg = "产品名称最大长度为64个字符";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 发行机构输入框获取焦点，设置输入框校验显示信息列的样式
 */
function issuerFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "发行机构，必填，最长16个字符";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 发行机构输入框失去焦点时的校验
 */
function issuerBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "发行机构不能为空";
    } else if(objValue.length > 16 ) {
        errMsg = "发行机构最大长度为16个字符";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 项目经理输入框获取焦点，设置输入框校验显示信息列的样式
 */
function projectManagerFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "项目经理，最长16个字符";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 项目经理输入框失去焦点时的校验
 */
function projectManagerBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue != "" && objValue.length > 16 ) {
        errMsg = "项目经理最大长度为16个字符";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 产品类型输入框获取焦点，设置输入框校验显示信息列的样式
 */
function productTypeFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "产品类型，必填，最长8个字符";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 产品类型输入框失去焦点时的校验
 */
function productTypeBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "产品类型不能为空";
    } else if(objValue.length > 8 ) {
        errMsg = "产品类型最大长度为8个字符";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 理财币种输入框获取焦点，设置输入框校验显示信息列的样式
 */
function currencyFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "理财币种，必填，最长8个字符";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 理财币种输入框失去焦点时的校验
 */
function currencyBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "理财币种不能为空";
    } else if(objValue.length > 8 ) {
        errMsg = "理财币种最大长度为8个字符";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 投资管理类型输入框获取焦点，设置输入框校验显示信息列的样式
 */
function managementTypeFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "投资管理类型，必填，最长8个字符";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 投资管理类型输入框失去焦点时的校验
 */
function managementTypeBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "投资管理类型不能为空";
    } else if(objValue.length > 16 ) {
        errMsg = "投资管理类型最大长度为16个字符";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 发售对象输入框获取焦点，设置输入框校验显示信息列的样式
 */
function placeTargetFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "发售对象，必填，最长16个字符";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 发售对象输入框失去焦点时的校验
 */
function placeTargetBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "发售对象不能为空";
    } else if(objValue.length > 16 ) {
        errMsg = "发售对象最大长度为16个字符";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 发行规模输入框获取焦点，设置输入框校验显示信息列的样式
 */
function issuesSizeFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "发行规模，必填，正整数，单位为万元";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 发行规模输入框失去焦点时的校验
 */
function issuesSizeBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "发行规模不能为空";
    } else if(!regInt.test(objValue)) {
    	errMsg = "发行规模必须为正整数";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 投资门槛输入框获取焦点，设置输入框校验显示信息列的样式
 */
function startAmountFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "投资门槛，必填，正整数，单位为万元";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 投资门槛输入框失去焦点时的校验
 */
function startAmountBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "投资门槛不能为空";
    } else if(!regInt.test(objValue)) {
    	errMsg = "投资门槛必须为正整数";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 产品期限输入框获取焦点，设置输入框校验显示信息列的样式
 */
function timeLimitFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "产品期限，必填，正整数，单位为月";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 产品期限输入框失去焦点时的校验
 */
function timeLimitBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "产品期限不能为空";
    } else if(!regInt.test(objValue)) {
    	errMsg = "产品期限必须为正整数";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 期限类型输入框获取焦点，设置输入框校验显示信息列的样式
 */
function timeLimitTypeFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "期限类型，必填，最长8个字符";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 期限类型输入框失去焦点时的校验
 */
function timeLimitTypeBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "期限类型不能为空";
    } else if(objValue.length > 8 ) {
        errMsg = "期限类型最大长度为8个字符";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 预期收益率 输入框获取焦点，设置输入框校验显示信息列的样式
 */
function expectedProfitFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "必填，小数(最多精确到小数点后4位)";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 预期收益率 输入框失去焦点时的校验
 */
function expectedProfitBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "预期收益率 不能为空";
    } else if(!regFloat.test(objValue)) {
    	errMsg = "预期收益率 必须为数字(最多小数点后4位)";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 收益类型 输入框获取焦点，设置输入框校验显示信息列的样式
 */
function earningsTypeFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "收益类型, 必填，最大长度8字符";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 收益类型 输入框失去焦点时的校验
 */
function earningsTypeBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "收益类型不能为空";
    } else if(objValue.length > 8) {
    	errMsg = "收益类型最大长度为8个字符";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 投资方式 输入框获取焦点，设置输入框校验显示信息列的样式
 */
function investmentStyleFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "投资方式, 必填，最大长度8字符";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 投资方式 输入框失去焦点时的校验
 */
function investmentStyleBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "投资方式不能为空";
    } else if(objValue.length > 8) {
    	errMsg = "投资方式最大长度为8个字符";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 资金投向 输入框获取焦点，设置输入框校验显示信息列的样式
 */
function fundInvestmentFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "资金投向, 必填，最大长度16字符";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 资金投向 输入框失去焦点时的校验
 */
function fundInvestmentBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "资金投向不能为空";
    } else if(objValue.length > 16) {
    	errMsg = "资金投向最大长度为16个字符";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 资金托管费率 输入框获取焦点，设置输入框校验显示信息列的样式
 */
function trustMoneyFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "必填，小数(最多精确到小数点后4位)";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 资金托管费率 输入框失去焦点时的校验
 */
function trustMoneyBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "资金托管费率 不能为空";
    } else if(!regFloat.test(objValue)) {
    	errMsg = "资金托管费率 必须为数字(最多小数点后4位)";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 销售手续费率 输入框获取焦点，设置输入框校验显示信息列的样式
 */
function sellFeeFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "必填，小数(最多精确到小数点后4位)";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 销售手续费率 输入框失去焦点时的校验
 */
function sellFeeBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "销售手续费率 不能为空";
    } else if(!regFloat.test(objValue)) {
    	errMsg = "销售手续费率 必须为数字(最多小数点后4位)";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 成立规模 输入框获取焦点，设置输入框校验显示信息列的样式
 */
function foundedSizeFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "成立规模，必填，正整数，单位为万元";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 成立规模 输入框失去焦点时的校验
 */
function foundedSizeBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "成立规模不能为空";
    } else if(!regInt.test(objValue)) {
    	errMsg = "成立规模必须为正整数";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 实际年收益率 输入框获取焦点，设置输入框校验显示信息列的样式
 */
function realProfitFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "必填，小数(最多精确到小数点后4位)";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 实际年收益率 输入框失去焦点时的校验
 */
function realProfitBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "实际年收益率 不能为空";
    } else if(!regFloat.test(objValue)) {
    	errMsg = "实际年收益率 必须为数字(最多小数点后4位)";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 发售地区 输入框获取焦点，设置输入框校验显示信息列的样式
 */
function placeAreaFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "发售地区, 必填，最大长度8字符";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 发售地区 输入框失去焦点时的校验
 */
function placeAreaBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue == "") {
        errMsg = "发售地区不能为空";
    } else if(objValue.length > 8) {
    	errMsg = "发售地区最大长度为8个字符";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 资金运用情况 输入框获取焦点，设置输入框校验显示信息列的样式
 */
function fundsAppliactionFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "资金运用情况,最大长度1000字符";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 资金运用情况 输入框失去焦点时的校验
 */
function fundsAppliactionBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue != "" && objValue.length > 1000) {
    	errMsg = "资金运用情况最大长度为1000个字符";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 信用增级情况 输入框获取焦点，设置输入框校验显示信息列的样式
 */
function creditEnhancementFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "信用增级情况，最大长度1000字符";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 信用增级情况  输入框失去焦点时的校验
 */
function creditEnhancementBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue != "" && objValue.length > 1000) {
    	errMsg = "信用增级情况 最大长度为1000个字符";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 其他相关信息 输入框获取焦点，设置输入框校验显示信息列的样式
 */
function otherInformationFocus(td_id_Col, s_id_Desc) {
    var infoMsg = "其他相关信息，最大长度1000字符";
    focusChk(td_id_Col, s_id_Desc, infoMsg);
}
/**
 * 其他相关信息 输入框失去焦点时的校验
 */
function otherInformationBlur(i_obj, td_id_Col, s_id_Desc) {
	var objValue = i_obj.value;
    if(objValue) {
    	objValue = objValue.trim();
    	i_obj.value = objValue;
    }
    
	var errMsg = "";
    if(objValue != "" && objValue.length > 1000) {
    	errMsg = "其他相关信息 最大长度为1000个字符";
    }
    
    return blurChk(td_id_Col, s_id_Desc, errMsg);
}

/**
 * 表单提交
 */
function addTrustProductFun() {
	// 校验产品名称
	var productNameObj = document.getElementById("productName");
	if(!productNameBlur(productNameObj, 'productNameCol', 'productNameDesc')) {
		return false;
	}
	
	// 校验 发行机构
	var issuerObj = document.getElementById("issuer");
	if(!issuerBlur(issuerObj, 'issuerCol', 'issuerDesc')) {
		return false;
	}
	
	// 项目经理
	var projectManagerObj = document.getElementById("projectManager");
	if(!projectManagerBlur(projectManagerObj, 'projectManagerCol', 'projectManagerDesc')) {
		return false;
	}
	
	// 产品类型
	var productTypeObj = document.getElementById("productType");
	if(!productTypeBlur(productTypeObj, 'productTypeCol', 'productTypeDesc')) {
		return false;
	}
	
	// 理财币种
	var currencyObj = document.getElementById("currency");
	if(!currencyBlur(currencyObj, 'currencyCol', 'currencyDesc')) {
		return false;
	}
	
	// 投资管理类型
	var managementTypeObj = document.getElementById("managementType");
	if(!managementTypeBlur(managementTypeObj, 'managementTypeCol', 'managementTypeDesc')) {
		return false;
	}
	
	// 发售对象
	var placeTargetObj = document.getElementById("placeTarget");
	if(!placeTargetBlur(placeTargetObj, 'placeTargetCol', 'placeTargetDesc')) {
		return false;
	}
	
	// 发行规模
	var issuesSizeObj = document.getElementById("issuesSize");
	if(!issuesSizeBlur(issuesSizeObj, 'issuesSizeCol', 'issuesSizeDesc')) {
		return false;
	}
	
	// 投资门槛
	var startAmountObj = document.getElementById("startAmount");
	if(!startAmountBlur(startAmountObj, 'startAmountCol', 'startAmountDesc')) {
		return false;
	}
	
	// 产品期限
	var timeLimitObj = document.getElementById("timeLimit");
	if(!timeLimitBlur(timeLimitObj, 'timeLimitCol', 'timeLimitDesc')) {
		return false;
	}
	
	// 期限类型
	var timeLimitTypeObj = document.getElementById("timeLimitType");
	if(!timeLimitTypeBlur(timeLimitTypeObj, 'timeLimitTypeCol', 'timeLimitTypeDesc')) {
		return false;
	}
	
	// 预期收益率
	var expectedProfitObj = document.getElementById("expectedProfit");
	if(!expectedProfitBlur(expectedProfitObj, 'expectedProfitCol', 'expectedProfitDesc')) {
		return false;
	}
	
	// 收益类型
	var earningsTypeObj = document.getElementById("earningsType");
	if(!earningsTypeBlur(earningsTypeObj, 'earningsTypeCol', 'earningsTypeDesc')) {
		return false;
	}

	// 投资方式
	var investmentStyleObj = document.getElementById("investmentStyle");
	if(!investmentStyleBlur(investmentStyleObj, 'investmentStyleCol', 'investmentStyleDesc')) {
		return false;
	}
	
	// 资金投向
	var fundInvestmentObj = document.getElementById("fundInvestment");
	if(!fundInvestmentBlur(fundInvestmentObj, 'fundInvestmentCol', 'fundInvestmentDesc')) {
		return false;
	}
	
	// 资金托管费率
	var trustMoneyObj = document.getElementById("trustMoney");
	if(!trustMoneyBlur(trustMoneyObj, 'trustMoneyCol', 'trustMoneyDesc')) {
		return false;
	}
	
	// 销售手续费率
	var sellFeeObj = document.getElementById("sellFee");
	if(!sellFeeBlur(sellFeeObj, 'sellFeeCol', 'sellFeeDesc')) {
		return false;
	}
	
	// 成立规模
	var foundedSizeObj = document.getElementById("foundedSize");
	if(!foundedSizeBlur(foundedSizeObj, 'foundedSizeCol', 'foundedSizeDesc')) {
		return false;
	}
	
	// 实际年收益率
	var realProfitObj = document.getElementById("realProfit");
	if(!realProfitBlur(realProfitObj, 'realProfitCol', 'realProfitDesc')) {
		return false;
	}
	
	// 发售地区
	var placeAreaObj = document.getElementById("placeArea");
	if(!placeAreaBlur(placeAreaObj, 'placeAreaCol', 'placeAreaDesc')) {
		return false;
	}
	
	// 资金运用情况
	var fundsAppliactionObj = document.getElementById("fundsAppliaction");
	if(!fundsAppliactionBlur(fundsAppliactionObj, 'fundsAppliactionCol', 'fundsAppliactionDesc')) {
		return false;
	}
	
	// 信用增级情况
	var creditEnhancementObj = document.getElementById("creditEnhancement");
	if(!creditEnhancementBlur(creditEnhancementObj, 'creditEnhancementCol', 'creditEnhancementDesc')) {
		return false;
	}
	
	// 其他相关信息
	var otherInformationObj = document.getElementById("otherInformation");
	if(!otherInformationBlur(otherInformationObj, 'otherInformationCol', 'otherInformationDesc')) {
		return false;
	}
	
	document.getElementById("trustProductForm").submit();
    return true;
}

